<!doctype html>
<html>
<head>
    <title>My JSP 'updateUser.jsp' starting page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="../../js/include.js"></script>
    <script type="text/javascript">
			function submitForm(){
				if($("#ff").form('validate')==true){
					$.ajax({   
					     url:url+"/system/resources/update",   
					     type:$("#ff").attr("method"),   
					     data:$("#ff").serializeArray(),
					     success:function(data){   
					    	 if(data.result=="success"){
					        	toList();
					        }else{
					        	$.messager.alert('提示',data.data);
					        }
					     }
					});
				}
			}
			function toList(){
				window.location=htmlURL+"/system/resources/list.html";
			}
			
			$(function(){
				$('#cc').combobox({
                    data:[{
                        "id":1,
                        "text":"菜单"
                    },{
                        "id":2,
                        "text":"按钮"
                    }],
					valueField:'id',
					textField:'text'
				});
				$.ajax({
					 url:url+'/system/resources/selectByPrimaryKey',
					 type:'post',
					 data:'id='+getQueryString("id"),
					 success:function(data){
						 $('#ff').form('load',data.data);
						 $('#cc').combobox('setValue',data.data.type);
					 }
				});

			})

    </script>
</head>

<body>
<form id="ff" action="" method="POST">
    <input type="hidden" name="id">
    <input type="hidden" name="pid"/>
    <table>

        <tr>
            <td>
                名称:
            </td>
            <td>
                <input type="text" name="name" class="easyui-textbox" required="true" validType="length[1,25]">
            </td>
        </tr>
        <tr>
            <td>
                地址:
            </td>
            <td>
                <input type="text" name="url" class="easyui-textbox" validType="length[0,50]">
            </td>
        </tr>
        <tr>
            <td>
                类型:
            </td>
            <td>
                <input id="cc" class="easyui-combobox" name="type" required="true">


                </input>
            </td>
        </tr>
        <tr>
            <td>排序:</td>
            <td><input type="text" name="sort" class="easyui-textbox" validType="length[0,25]"></td>
        </tr>

    </table>
</form>
<div id="dlg-buttons">
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">保存</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="toList()">返回</a>
</div>
</body>
</html>
